#include <bits/stdc++.h>

using namespace std;

vector<vector<string>> groupAnagrams(vector<string>& strs);

int main()
{
	return 0;
}

vector<vector<string>> groupAnagrams(vector<string>& strs)
{
	// TODO 烂尾, 语法不会
	unordered_map<long, vector<string>> map;
	hash<short> encode;
	for (auto str : strs) {
		short freq[26] = { 0 };
		for (auto c : str)
			freq[c - 'a']++;

		long key = 0;
		for (auto f : freq)
			key = (key << 2) ^ encode(f) + 1;
		map[key].emplace_back(str);
	}

	vector<vector<string>> res;
	for(auto str_vec: map)
		res.emplace_back(str_vec.second);
	return res;
}
